import request from '@/utils/request'

// 查询生产工单列表
export function listOrder(query) {
  return request({
    url: '/scdd/order/list',
    method: 'get',
    params: query
  })
}

// 查询生产工单详细
export function getOrder(gdCode) {
  return request({
    url: '/scdd/order/' + gdCode,
    method: 'get'
  })
}

// 新增生产工单
export function addOrder(data) {
  return request({
    url: '/scdd/order/add',
    method: 'post',
    data: data
  })
}

//查询工单关联Bom
export function listBom(gdCode){
  return request({
    url: "/scdd/order/Bom",
    method:"get",
    params:{gdCode}
  })
}

//查询产品属性
export function getCpAttribute(cpCode){
  return request({
    url: "/scdd/order/value",
    method:"get",
    params:{cpCode}
  })
}

//工单投产
export function updateGdStatus(gdCode,status) {
  return request({
    url: '/scdd/order/gdStatus',
    method: 'get',
    params: { gdCode , status }
  })
}

// 修改生产工单
export function updateOrder(data) {
  return request({
    url: '/scdd/order/put',
    method: 'post',
    data: data
  })
}

// 删除生产工单
export function delOrder(gdCode) {
  return request({
    url: '/scdd/order/' + gdCode,
    method: 'delete'
  })
}
